package bairui.international.weixin.portal.miniapp.controller.user;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lianjing.sh.spring.web.controller.base.action.Action;
import com.lianjing.sh.spring.web.controller.enhance.output.FomatOutput;

import bairui.international.model.domain.jpa.TB_User;
import bairui.international.service.Service_User;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 *
 * 账户操作
 *
 * @generated
 * 
 * @see STest_C_User_Account_EditBank 测试
 *
 */
@Controller
public class C_User_Account_EditBank
 extends SC_User_Account_EditBank 
{
	
	@Autowired private Service_User service_User;
	
	/**
	 * 编辑开户行
	 */
	@Action(EditBank.class)
	@PostMapping(EditBank.RequestMappingValue)
	public @FomatOutput @ResponseBody Object editBank(
		ModelMap map, HttpServletRequest request,
		@RequestBody Input input,
		@RequestParam String skey
	) throws Exception {
		TB_User user = service_User.findOne(it->it.skey.eq(skey));
		//
		TB_User bean = service_User.edit(user.getId(), null, null, null, null, input.getBank());
		return new C_User_Account_Get.Output(bean);
	}
	
	@NoArgsConstructor
	@AllArgsConstructor
	public static class Input {
		private @Setter @Getter String bank;
	}
	

}
